<template>
  <!-- 品牌 brand -->
  <div class="bg">
    <div class="container">
      <div class="box-pingpai" v-for="(item,i) in imgUrl" :key="i" @mouseenter="item.isActive = true"
        @mouseleave="item.isActive = false">
        <router-link :to="item.href">
          <el-image ref="bannerheight" :src="item.Img" alt="" fit="cover"></el-image>
          <div class="mask" :class="{animationbox:item.isActive}">
            <div class="brand-tag">{{item.tag}}</div>
            <div class="brand-title">
              <p v-html="item.title"></p>
            </div>
            <div class="brand-describe">
              <p v-html="item.describe"></p>
            </div>
          </div>
        </router-link>
      </div>
    </div>
  </div>
</template>

<script>
import './css.css'
export default {
  data () {
    return {
      imgUrl: [
        
      ],
    }
  },
  methods: {
    //获取数据
    async getData () {
      const { data:ret} = await this.$http.get('/static/data.json')
      let arr = []
      arr = ret.data.brand
      this.imgUrl = arr.slice(arr.length - 2, arr.length)
      console.log(this.imgUrl)
    },
  },
  mounted () {
    this.getData()
  }
}
</script>

<style lang='less' scoped>
.bg {
  display: flex;
  align-items: center;
  .container {
    display: flex;
    .box-pingpai {
      width: auto;
      position: relative;
      .mask {
        position: absolute;
        top: 0;
        opacity: 0;
        background: transparent;
        width: 100%;
        height: 100%;
      }
    }
  }
  .mask {
    background: #77b828;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    padding-bottom: 6.2rem;
    .brand-tag {
      font-size: 1.1rem;
    }
    .brand-tag::before {
      content: "";
      display: block;
      width: 4rem;
      height: 2px;
      background: #fff;
      margin: 0 auto 10px;
    }
    .brand-title {
      font-size: 2.2rem;
      p {
        text-align: center;
        margin-bottom: 0.1rem;
        line-height: 3rem;
        font-weight: 500;
      }
    }
    .brand-describe {
      font-size: 0.8rem;
      font-weight: 400;
      line-height: 1.2rem;
      p {
        text-align: center;
      }
    }
  }
}

@media only screen and (max-width: 992px) {
  .bg {
    .container {
      flex-direction: column;
      align-items: center;
      height: 100vh;
      overflow: hidden;
      margin: 10px 20px;
      .box-pingpai {
        height: 50%;
        width: 100%;
        .el-image {
          width: 100%;
          height: 100%;
        }
      }
      .mask {
        padding-bottom: 0rem;
      }
    }
  }
}
</style>

